<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title>controlling retina/density of responsive images with lazysizes and the optimumx plugin</title>
	<link href="../assets/css/tidy.css" rel="stylesheet" />
	<style>
		.container {
			max-width: 1200px;
			min-width: 320px;
			margin: auto;
			padding: 10px;
		}
		#arena {
			display: block;
			margin: auto;
			border: 1px solid #000;
			width: 75%;
			height: 720px;
			resize: both;
		}

		form .row {
			margin-bottom: 15px;
		}
		.alert-noretina {
			display: none;
		}
		.no-retina .alert-noretina {
			display: block;
		}
	</style>
	<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
	<script src="//afarkas.github.io/webshim/js-webshim/minified/polyfiller.js"></script>

	<script src="js/parent.js"></script>
</head>
<body>

<div class="container">
	<div class="alert alert-info">
		<p>The <code>srcset</code> with the <code>sizes</code> attribute is definitely the way to go to create responsive, flexibel, adaptive images.</p>
		<p>Unfortunately there is no way to tell the browser, that a specific image doesn't gain much perceived quality with a higher density or that image quality of a specific image isn't important for the user experience.</p>
		<p>Due to the fact, that a 2x retina means 4x data and 3x retina means 9x data, performance can suffer even on good connections badly.</p>
		<p><a href="https://github.com/aFarkas/lazysizes/tree/gh-pages/plugins/optimumx">lazySizes <code>data-optimumx</code> feature</a> (build on top of <code>data-sizes="auto"</code>) gives the developer more control to use adaptive images markup, but opt-out from to high retina at some point by defining the optimum density.</p>
	</div>
	<div class="alert alert-danger alert-noretina">
		<p>Unfortunately this demo makes only sense, if you are using a retina device. Maybe come back with one (tablet / smartphone)? Sorry!</p>
	</div>
	<div class="panel panel-default">
		<div class="panel-heading">Configure the <code>data-optimumx</code> attribute</div>
		<div class="panel-body">
			<form role="form" class="arena-config show-activelabeltooltip">
				<fieldset>
					<legend><code>data-optimumx</code></legend>
					<div class="row">
						<div class="form-group">
							<div class="col-sm-6">
								<label for="optimumx">optimumx</label>
								<input id="optimumx" name="optimumx" value="1.5" min="1" max="1.9" step="0.1" type="range" />
							</div>
						</div>
					</div>

				</fieldset>
				<div class="row">
					<div class="form-group start-buttons">
						<div class="col-sm-4">
							<button type="submit" class="btn btn-primary">load config</button>
						</div>
						<div class="col-sm-4">
							<button type="button" class="btn btn-primary btn-optimum">load image specific</button>
						</div>
						<div class="col-sm-4">
							<button type="button" class="btn btn-primary btn-auto">load with "auto" value</button>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="form-group">
						<div class="col-sm-6">
							<label for="viewport">viewport width</label>
							<input id="viewport" value="75" min="50" max="100" step="1" type="range" />
						</div>
						<div class="col-sm-6">
							<div class="checkbox">
								<label>
									<input id="vw-input" type="checkbox" checked=""> oninput / onchange
								</label>
							</div>
							<p class="help-block">Wether viewport should be changed while dragging (input/checked) or on drag release (change/unchecked).</p>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

	<iframe id="arena"></iframe>
</div>

</body>
</html>
